package com.cc.controller;

import com.cc.entity.Book;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import java.util.ArrayList;
import java.sql.Date;
import java.util.List;

@Controller
@RequestMapping("/Books")
@ResponseBody

public class BookRestController {
    @GetMapping
    public List<Book> findList(@DateTimeFormat(pattern = "yyyy-MM-dd") Date dateTime){
        List<Book> Books = new ArrayList<>();
        Book book = new Book();
        book.setId(1);
        book.setBookName("十日终焉");
        book.setBookType("玄幻");
        book.setDescription("烧脑");
        book.setAuthor("虫队");
        book.setDateTime(dateTime);
        Books.add(book);

        return Books;
    }
}
